# Maintainer: kpcyrd <kpcyrd[at]archlinux[dot]org>
# Contributor: Julien (jvoisin) Voisin <julien.voisin+snuffleupagus@dustri.org>

pkgname=php-snuffleupagus
_pkgname=snuffleupagus
pkgver=0.10.0
pkgrel=2
pkgdesc="Security module for PHP"
url='https://snuffleupagus.readthedocs.io/'
arch=('loong64' 'x86_64')
license=('LGPL3')
depends=('php')
backup=('etc/php/conf.d/snuffleupagus.ini'
        'etc/php/conf.d/snuffleupagus.rules')
source=(https://github.com/jvoisin/${_pkgname}/archive/v${pkgver}/${_pkgname}-${pkgver}.tar.gz)
sha256sums=('2b48dc38e208e793d3e694688d9ae9fc429e99a8df01133f6e0a4444036ba304')
b2sums=('74871999de8d5523dc8ab0cc3c9c29749f0a7e76154fef748dd477529975ea87a5846d3f746df847b1ee88c1a8e23a4e3b8b74e06c6a9000605ca73d5d031a66')

build() {
  cd ${_pkgname}-${pkgver}/src
  phpize
  ./configure --prefix=/usr --enable-"${_pkgname}"
  make
}

check() {
  cd ${_pkgname}-${pkgver}/src
  NO_INTERACTION=1 REPORT_EXIT_STATUS=1 make test
}

package() {
  cd ${_pkgname}-${pkgver}
  make -C src INSTALL_ROOT="${pkgdir}" install
  install -D -m644 "config/default_php8.rules" "${pkgdir}/etc/php/conf.d/${_pkgname}.rules"
  install -D -m644 "config/${_pkgname}.ini" "${pkgdir}/etc/php/conf.d/${_pkgname}.ini"
}

# vim: ts=2 sw=2 et:
